<div class="row-fluid">
    <div class="span4">
		<fieldset>
			<legend>
			#i18n{portal.rbac.assign_users.role.name} : ${role.key}
			
			</legend>
            <p>
				<i class="icon-info-sign"></i>&nbsp;#i18n{portal.rbac.assign_users.role.description} : ${role.description}
			</p>
            <p>
				<i class="icon-user"></i>&nbsp;#i18n{portal.rbac.assign_users.role.number_user} : 
				<span class="badge">${assigned_users_number}</span>
			</p>
            <p>
				<strong>#i18n{portal.rbac.assign_users.role.actions}</strong>
			</p>
			<p>
				<a class="btn btn-primary btn-small" href="jsp/admin/rbac/ViewRoleDescription.jsp?role_key=${role.key}" title="#i18n{portal.rbac.modify_role.buttonLabelModify}" >
					<i class="icon-edit icon-white"></i>
				</a>
				<a class="btn btn-danger btn-small" href="jsp/admin/rbac/DoConfirmRemoveRole.jsp?role_key=${role.key}" title="#i18n{portal.rbac.manage_roles.buttonLabelDelete}" >
					<i class="icon-trash icon-white"></i>
				</a>
			</p>
			<hr>
			<p></p>
			<br>
			<#if assigned_users_list?size &gt; 10 || search_is_search >
				<form class="form" method="post" name="search_users" action="jsp/admin/rbac/AssignUsersRole.jsp">
				<input type="hidden" name="role_key" value="${role.key}">
				<#if (user_levels?has_content)>
				<label for="user_level">#i18n{portal.users.manage_users.search_users.userLevelLabel} </label>
					<select id="user_level" name="search_user_level">
						<#if (search_admin_user_filter.userLevel > -1) >
							<option value="noValue" >#i18n{portal.users.manage_users.search_users.labelAllLevels}</option>
							<#list user_levels as user_level>
								<#if (search_admin_user_filter.userLevel == user_level.id) >
									<option value="${user_level.id}" selected="selected" >${user_level.name}</option>
								<#else>
									<option value="${user_level.id}" >${user_level.name}</option>
								</#if>
							</#list>
						<#else>
							<option value="noValue" selected="selected" >#i18n{portal.users.manage_users.search_users.labelAllLevels}</option>
							<#list user_levels as user_level>
								<option value="${user_level.id}" >${user_level.name}</option>
							</#list>
						</#if>
					</select>
				</#if>
                <label class="control-label" for="access_code">#i18n{portal.users.manage_users.search_users.labelAccessCode}</label>
                <input type="text" id="access_code" name="search_access_code" value="${search_admin_user_filter.accessCode}">
                <label class="control-label" for="last_name" >#i18n{portal.users.manage_users.search_users.labelLastName} </label>
                <input type="text"  id="last_name" name="search_last_name" value="${search_admin_user_filter.lastName}" maxlength="100" size="35" tabindex="2" />
                <label class="control-label" for="first_name">#i18n{portal.users.manage_users.search_users.labelFirstName}</label>
                <input type="text" id="first_name" name="search_first_name" value="${search_admin_user_filter.firstName}" maxlength="100" size="35" tabindex="3" />
                <label class="control-label" for="email">#i18n{portal.users.manage_users.search_users.labelEmail}</label>
                <input type="text" id="email" name="search_email" value="${search_admin_user_filter.email}" maxlength="100" size="35" tabindex="4" />
                <label class="control-label" for="status">#i18n{portal.users.manage_users.search_users.labelStatus}</label>
                <select id="status" name="search_status" tabindex="5">
                <#switch search_admin_user_filter.status >
                    <#case 0 >
                        <option value="noValue" >#i18n{portal.users.manage_users.search_users.labelAllStatus}</option>
						<option value="0" selected="selected" >#i18n{portal.users.create_user.statusLabelEnabled}</option>
                        <option value="1" >#i18n{portal.users.create_user.statusLabelDisabled}</option>
                    <#break>
                    <#case 1 >
						<option value="noValue" >#i18n{portal.users.manage_users.search_users.labelAllStatus}</option>
						<option value="0" >#i18n{portal.users.create_user.statusLabelEnabled}</option>
						<option value="1" selected="selected" >#i18n{portal.users.create_user.statusLabelDisabled}</option>
                    <#break>
                    <#default>
						<option value="noValue" selected="selected" >#i18n{portal.users.manage_users.search_users.labelAllStatus}</option>
                        <option value="0" >#i18n{portal.users.create_user.statusLabelEnabled}</option>
                        <option value="1" >#i18n{portal.users.create_user.statusLabelDisabled}</option>
                    <#break>
                </#switch>
                </select>
				<p>
                <#list attributes_list as attribute>
                    <#if attribute.shownInSearch>
						${attribute.getHtmlFormSearchAttribute( search_admin_user_field_filter, locale )}
                    </#if>
						<button class="btn btn-primary btn-small" type="submit" name="search_is_search">
							<i class="icon-search icon-white"></i>&nbsp;#i18n{portal.users.manage_users.search_users.buttonSearch}
						</button>
                    </#list>
				</p>	
                    
                </form>
			</#if>
        </fieldset>
    </div>
    <div class="span7">
		<fieldset>
			<legend>#i18n{portal.rbac.assign_users.pageTitle}<small class="pull-right"><@item_navigation item_navigator=item_navigator /></small></legend>
            <#if available_users_list?size &gt; 0 >
				<form class="form" name="assignUser" method="post" action="jsp/admin/rbac/DoAssignUsersRole.jsp">
					<input type="hidden" name="role_key" value="${role.key}">
					<p class="lead">#i18n{portal.rbac.assign_users.labelAvailableUser}</p>
					<p>
						<@comboWithParamsAndLength name="available_users_list" default_value="" additionalParameters="multiple='multiple' size='10' style='width:100%;'" items=available_users_list max_length=175 /></td>
					</p>
					<button class="btn btn-primary btn-small" type="submit" >
						<i class="icon-ok icon-white"></i>&nbsp;#i18n{portal.rbac.assign_users.labelButtonValidate}
					</button>
				</form>
            <#else>
                <div class="alert alert-error">#i18n{portal.rbac.assign_users.noUserToAssign}</div>
            </#if>
            <hr>           
            <p class="lead">#i18n{portal.rbac.assign_users.labelAssignedUser}</p>
            <#if assigned_users_list?size &gt; 0 || search_is_search >
				<form method="post" action="jsp/admin/rbac/AssignUsersRole.jsp">
            <@paginationAdmin paginator=paginator combo=1 form=0 />
            <#if search_is_search >
            <input type="hidden" name="search_is_search" value="true"/>
            <input type="hidden" name="search_user_level" value="${search_admin_user_filter.userLevel}"/>
            <input type="hidden" name="search_access_code" value="${search_admin_user_filter.accessCode}"/>
            <input type="hidden" name="search_last_name" value="${search_admin_user_filter.lastName}"/>
            <input type="hidden" name="search_first_name" value="${search_admin_user_filter.firstName}"/>
            <input type="hidden" name="search_email" value="${search_admin_user_filter.email}"/>
            <input type="hidden" name="search_status" value="${search_admin_user_filter.status}"/>
            </#if>
            <#if search_admin_user_field_filter.listUserFields?exists && search_admin_user_field_filter.listUserFields?has_content>
   				<#list search_admin_user_field_filter.listUserFields as user_field>
   					<#if user_field.attribute.attributeType.className == "fr.paris.lutece.portal.business.user.attribute.AttributeComboBox">
   						<input type="hidden" name="attribute_${user_field.attribute.idAttribute}" value="${user_field.attributeField.idField}"/>
   					<#else>
   						<input type="hidden" name="attribute_${user_field.attribute.idAttribute}" value="${user_field.value}" />
   					</#if>
   				</#list>
   			</#if>
            <input type="hidden" name="role_key" value="${role.key}" />
        </form>
				<table class="table table-striped table-condensed">
					<tr>
						<th>#i18n{portal.users.manage_users.columnTitleLastName}<@sort jsp_url="jsp/admin/rbac/AssignUsersRole.jsp" attribute="lastName&role_key=${role.key}${sort_search_attribute}" /></th>
						<th>#i18n{portal.users.manage_users.columnTitleFirstName}<@sort jsp_url="jsp/admin/rbac/AssignUsersRole.jsp" attribute="firstName&role_key=${role.key}${sort_search_attribute}" /></th>
						<th>#i18n{portal.users.manage_users.columnTitleAccessCode}<@sort jsp_url="jsp/admin/rbac/AssignUsersRole.jsp" attribute="accessCode&role_key=${role.key}${sort_search_attribute}" /></th>
						<th>#i18n{portal.users.manage_users.columnTitleEmail} <@sort jsp_url="jsp/admin/rbac/AssignUsersRole.jsp" attribute="email&role_key=${role.key}${sort_search_attribute}" /></th>
						<th>#i18n{portal.users.manage_users.columnTitleActions}</th>
					</tr>
					<#list assigned_users_list as assigned_user>
					<#if assigned_user_has_next>
					<#assign anchor = assigned_user_index>
					<#else>
					<#assign anchor = assigned_user_index - 1 >
					</#if>
					<tr id="anchor-${assigned_user_index}">
						<td>${assigned_user.lastName}</td>
						<td>${assigned_user.firstName}</td>
						<td><em>${assigned_user.accessCode}</em></td>
						<td>
							<a class="btn btn-link" href="mailto:${assigned_user.email}"  title="${assigned_user.email}">${assigned_user.email}</a>							</a>
						</td>
						<td>
							<a class="btn btn-primary btn-small" href="jsp/admin/user/ModifyUser.jsp?id_user=${assigned_user.userId}"  title="#i18n{portal.rbac.assign_users.actionModify}" >
								<i class="icon-edit icon-white"></i>
							</a>
							<a class="btn btn-danger btn-small" href="jsp/admin/rbac/DoUnassignUserRole.jsp?id_user=${assigned_user.userId}&amp;role_key=${role.key}&anchor=anchor-${anchor}"  title="#i18n{portal.rbac.assign_users.actionUnassign}" >
								<i class="icon-trash icon-white"></i>
							</a>
						</td>
					</tr>
					</#list>
				</table>
				<@paginationAdmin paginator=paginator />
			<#else>
				<div class="alert alert-error">#i18n{portal.rbac.assign_users.noAssignedList}</div>
			</#if>
		</fieldset>	
    </div>
</div>